package com.zbl.zblproject.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zbl.zblproject.core.entity.UserAddress;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/17
 */
@Repository
public interface UserAddressMapper extends BaseMapper<UserAddress> {

    @Select("SELECT address FROM  zbl_user_address WHERE user_id = #{userId} ")
    String selectAddressByUserId(@Param("userId") int userId);

    @Select("SELECT * FROM  zbl_user_address WHERE user_id = #{userId} ")
    List<UserAddress> selectAddressesByUserId(@Param("userId") int userId);

    @Select("SELECT * FROM zbl_user_address WHERE user_id = #{userId} LIMIT 1")
    UserAddress selectOneByUserId(@Param("userId") int userId);

}
